1 /* 2 3 Boost Software License - Version 1.0 - August 17th, 2003 4 5 Permission is hereby granted, free of charge, to any person or organization 6 obtaining a copy of the software and accompanying documentation covered by 7 this license (the "Software") to use, reproduce, display, distribute, 8 execute, and transmit the Software, and to prepare derivative works of the 9 Software, and to permit third-parties to whom the Software is furnished to 10 do so, all subject to the following: 11 12 The copyright notices in the Software and this entire statement, including 13 the above license grant, this restriction and the following disclaimer, 14 must be included in all copies of the Software, in whole or in part, and 15 all derivative works of the Software, unless such copies or derivative 16 works are solely in the form of machine-executable object code generated by 17 a source language processor. 18 19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 DEALINGS IN THE SOFTWARE. 26 27 */ 28 29 module derelict.glib.gmarkup; 30 31 import derelict.glib.gtypes; 32 import derelict.glib.glibconfig; 33 import derelict.glib.gerror; 34 import derelict.glib.gquark; 35 import derelict.glib.gslist; 36 import core.stdc.config; 37 import std.c.stdarg; 38 39 extern (C): 40 41 alias _Anonymous_0 GMarkupError; 42 alias _Anonymous_1 GMarkupParseFlags; 43 alias _GMarkupParseContext GMarkupParseContext; 44 alias _GMarkupParser GMarkupParser; 45 alias _Anonymous_2 GMarkupCollectType; 46 47 enum _Anonymous_0 48 { 49 G_MARKUP_ERROR_BAD_UTF8 = 0, 50 G_MARKUP_ERROR_EMPTY = 1, 51 G_MARKUP_ERROR_PARSE = 2, 52 G_MARKUP_ERROR_UNKNOWN_ELEMENT = 3, 53 G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE = 4, 54 G_MARKUP_ERROR_INVALID_CONTENT = 5, 55 G_MARKUP_ERROR_MISSING_ATTRIBUTE = 6 56 } 57 58 enum _Anonymous_1 59 { 60 G_MARKUP_DO_NOT_USE_THIS_UNSUPPORTED_FLAG = 1, 61 G_MARKUP_TREAT_CDATA_AS_TEXT = 2, 62 G_MARKUP_PREFIX_ERROR_POSITION = 4 63 } 64 65 enum _Anonymous_2 66 { 67 G_MARKUP_COLLECT_INVALID = 0, 68 G_MARKUP_COLLECT_STRING = 1, 69 G_MARKUP_COLLECT_STRDUP = 2, 70 G_MARKUP_COLLECT_BOOLEAN = 3, 71 G_MARKUP_COLLECT_TRISTATE = 4, 72 G_MARKUP_COLLECT_OPTIONAL = 65536 73 } 74 75 struct _GMarkupParser 76 { 77 void function (GMarkupParseContext*, const(gchar)*, const(gchar*)*, const(gchar*)*, gpointer, GError**) start_element; 78 void function (GMarkupParseContext*, const(gchar)*, gpointer, GError**) end_element; 79 void function (GMarkupParseContext*, const(gchar)*, gsize, gpointer, GError**) text; 80 void function (GMarkupParseContext*, const(gchar)*, gsize, gpointer, GError**) passthrough; 81 void function (GMarkupParseContext*, GError*, gpointer) error; 82 } 83 84 struct _GMarkupParseContext; 85 86 version(Derelict_Link_Static) 87 { 88 extern( C ) nothrow 89 { 90 GQuark g_markup_error_quark(); 91 GMarkupParseContext* g_markup_parse_context_new(const(GMarkupParser)* parser, GMarkupParseFlags flags, gpointer user_data, GDestroyNotify user_data_dnotify); 92 void g_markup_parse_context_free(GMarkupParseContext* context); 93 gboolean g_markup_parse_context_parse(GMarkupParseContext* context, const(gchar)* text, gssize text_len, GError** error); 94 void g_markup_parse_context_push(GMarkupParseContext* context, const(GMarkupParser)* parser, gpointer user_data); 95 gpointer g_markup_parse_context_pop(GMarkupParseContext* context); 96 gboolean g_markup_parse_context_end_parse(GMarkupParseContext* context, GError** error); 97 const(gchar)* g_markup_parse_context_get_element(GMarkupParseContext* context); 98 const(GSList)* g_markup_parse_context_get_element_stack(GMarkupParseContext* context); 99 void g_markup_parse_context_get_position(GMarkupParseContext* context, gint* line_number, gint* char_number); 100 gpointer g_markup_parse_context_get_user_data(GMarkupParseContext* context); 101 gchar* g_markup_escape_text(const(gchar)* text, gssize length); 102 gchar* g_markup_printf_escaped(const(char)* format, ...); 103 gchar* g_markup_vprintf_escaped(const(char)* format, va_list args); 104 gboolean g_markup_collect_attributes(const(gchar)* element_name, const(gchar*)* attribute_names, const(gchar*)* attribute_values, GError** error, GMarkupCollectType first_type, const(gchar)* first_attr, ...); 105 } 106 } 107 else 108 { 109 extern( C ) nothrow 110 { 111 alias da_g_markup_error_quark = GQuark function(); 112 alias da_g_markup_parse_context_new = GMarkupParseContext* function(const(GMarkupParser)* parser, GMarkupParseFlags flags, gpointer user_data, GDestroyNotify user_data_dnotify); 113 alias da_g_markup_parse_context_free = void function(GMarkupParseContext* context); 114 alias da_g_markup_parse_context_parse = gboolean function(GMarkupParseContext* context, const(gchar)* text, gssize text_len, GError** error); 115 alias da_g_markup_parse_context_push = void function(GMarkupParseContext* context, const(GMarkupParser)* parser, gpointer user_data); 116 alias da_g_markup_parse_context_pop = gpointer function(GMarkupParseContext* context); 117 alias da_g_markup_parse_context_end_parse = gboolean function(GMarkupParseContext* context, GError** error); 118 alias da_g_markup_parse_context_get_element = const(gchar)* function(GMarkupParseContext* context); 119 alias da_g_markup_parse_context_get_element_stack = const(GSList)* function(GMarkupParseContext* context); 120 alias da_g_markup_parse_context_get_position = void function(GMarkupParseContext* context, gint* line_number, gint* char_number); 121 alias da_g_markup_parse_context_get_user_data = gpointer function(GMarkupParseContext* context); 122 alias da_g_markup_escape_text = gchar* function(const(gchar)* text, gssize length); 123 alias da_g_markup_printf_escaped = gchar* function(const(char)* format, ...); 124 alias da_g_markup_vprintf_escaped = gchar* function(const(char)* format, va_list args); 125 alias da_g_markup_collect_attributes = gboolean function(const(gchar)* element_name, const(gchar*)* attribute_names, const(gchar*)* attribute_values, GError** error, GMarkupCollectType first_type, const(gchar)* first_attr, ...); 126 } 127 128 __gshared 129 { 130 da_g_markup_error_quark g_markup_error_quark; 131 da_g_markup_parse_context_new g_markup_parse_context_new; 132 da_g_markup_parse_context_free g_markup_parse_context_free; 133 da_g_markup_parse_context_parse g_markup_parse_context_parse; 134 da_g_markup_parse_context_push g_markup_parse_context_push; 135 da_g_markup_parse_context_pop g_markup_parse_context_pop; 136 da_g_markup_parse_context_end_parse g_markup_parse_context_end_parse; 137 da_g_markup_parse_context_get_element g_markup_parse_context_get_element; 138 da_g_markup_parse_context_get_element_stack g_markup_parse_context_get_element_stack; 139 da_g_markup_parse_context_get_position g_markup_parse_context_get_position; 140 da_g_markup_parse_context_get_user_data g_markup_parse_context_get_user_data; 141 da_g_markup_escape_text g_markup_escape_text; 142 da_g_markup_printf_escaped g_markup_printf_escaped; 143 da_g_markup_vprintf_escaped g_markup_vprintf_escaped; 144 da_g_markup_collect_attributes g_markup_collect_attributes; 145 } 146 }